package parkingLotAction;

import parkingLot.ParkingLot;
import parkingLotDao.ParkingLotDao;

import com.opensymphony.xwork2.ActionSupport;

public class ParkingLotAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long id;

	private ParkingLot parkingLot;

	private ParkingLotDao parkingLotDao;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public ParkingLot getParkingLot() {
		return parkingLot;
	}

	public void setParkingLot(ParkingLot parkingLot) {
		this.parkingLot = parkingLot;
	}

	public ParkingLotDao getParkingLotDao() {
		return parkingLotDao;
	}

	public void setParkingLotDao(ParkingLotDao parkingLotDao) {
		this.parkingLotDao = parkingLotDao;
	}

	public String create() {
		return SUCCESS;
	}

	public String delete() {
		return SUCCESS;
	}

	public String updateFeature() {
		ParkingLot temp = parkingLotDao.selectAll();
		parkingLot.setId(temp.getId());
		parkingLot.setFunction(temp.getFunction());
		parkingLot.setIntroduction(temp.getIntroduction());
		parkingLot.setSoftware(temp.getSoftware());
		parkingLotDao.update(parkingLot);
		return SUCCESS;
	}

	public String updateFunction() {
		ParkingLot temp = parkingLotDao.selectAll();
		parkingLot.setId(temp.getId());
		parkingLot.setFeature(temp.getFeature());
		parkingLot.setIntroduction(temp.getIntroduction());
		parkingLot.setSoftware(temp.getSoftware());
		parkingLotDao.update(parkingLot);
		return SUCCESS;
	}

	public String updateIntro() {
		ParkingLot temp = parkingLotDao.selectAll();
		parkingLot.setId(temp.getId());
		parkingLot.setFeature(temp.getFeature());
		parkingLot.setFunction(temp.getFunction());
		parkingLot.setSoftware(temp.getSoftware());
		parkingLotDao.update(parkingLot);
		return SUCCESS;
	}

	public String updateSoft() {
		ParkingLot temp = parkingLotDao.selectAll();
		parkingLot.setId(temp.getId());
		parkingLot.setFeature(temp.getFeature());
		parkingLot.setFunction(temp.getFunction());
		parkingLot.setIntroduction(temp.getIntroduction());
		parkingLotDao.update(parkingLot);
		return SUCCESS;
	}

	public String select() {
		parkingLot = parkingLotDao.selectAll();
		return SUCCESS;
	}
}
